extends Talent
var utils = globalData.infoDs["g_AneHekUtils"]
var flag = 0
func init():
	name = "进化汲取[通用]"

func _connect():
	flag = 1
	sys.main.connect("onBattleStart",self,"run")
	sys.main.connect("onSureEvo",self,"run2")

func run():
	flag = 1

func run2():
	if flag:
		flag = 0
		var maxlv = 0
		for i in sys.main.btGrid.get_children():
			var cha = i.get_child(0)
			if cha.sureEvo:
				maxlv = max(maxlv,cha.lv)
		var waitadd = 0
		if maxlv == 1:
			waitadd = 67
		else:
			waitadd = pow(3,(maxlv - 2))  * 100
		sys.main.player.plusGold(waitadd)
		print("进化汲取：获得",waitadd,"金币")

	
func get_info():
	return  "当有单位可升级时，获得该单位卖出价格的一半，每场战斗结束后只能触发一次[取最高级]\n此天赋不需要升级"

